const app = getApp()
const state = { 
  a: [
    {
      time: "2023年11月11日",
      id: 1,
      arr: [
        {
          a: "张加一",
          b: "16178830",
          c: "血管瘤",
          d: "M9120/0",
          e: 1,
          f: 500,
          g: 500,
          h: "2023-11-11 15:21"
        }
      ]
    }
  ],
  b: [
    {
      time: "2023年12月01日",
      id: 1,
      arr: [
        {
          a: "李桂平",
          b: "16177721",
          c: "肿瘤内科",
          d: "1120",
          e: 1,
          f: 900,
          g: 900,
          h: "2023-12-01 10:44"
        }
      ]
    }
  ]
}
Page({

  /**
   * 页面的初始数据
   */
  data: {
    loading: false,
    activeTab: "a",
    list: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    const activeTab = options.activeTab || "a"
    this.setData({
      activeTab
    })
    this.getList()
  },

  onTabChange(e) {
    this.setData({
      activeTab: e.detail.name
    })
    this.getList()
  },

  getList() {
    this.setData({
      loading: true,
      list: [],
    },() => {
      setTimeout(_ => {
        this.setData({
          loading: false,
          list: state[this.data.activeTab]
        })
      },300);
    })
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})